package com.yanfan.common.config;

import com.yanfan.common.utils.AuthOsValidUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 授权码监听事件
 */
@Component
@Slf4j
@Order(0)
public class AuthOSValidListener implements ApplicationRunner {

    @Override
    public void run(ApplicationArguments args) throws Exception {
        // 启用授权码功能
        validate();
    }

    public void validate() {
        // 开启验证机器码
//        new AuthOsValidUtil().verification();
    }


    @Scheduled(cron = "0 0/10 * * * ?")   //10执行一次
    private void validateTime() {
        validate();
    }
}
